#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
bool cmp(double a, double b) {
	return a>b;
}
double res[505];
char ch[20];
int main() {
	int n;
	while (cin>>n) {
		for (int i=0; i<n; ++i) {
			scanf("%s", ch);
			scanf("%lf", &res[i]);
		}
		sort(res, res+n, cmp);
		double ans=0;
		for (int i=0; i<n; ++i) {
			ans+=(i+1)*res[i];
		}
		printf("%.4lf\n", ans);
	}
	return 0;
}
